﻿using KoolearnSample.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace KoolearnSample.ViewModel
{
    /// <summary>
    /// 考试的ViewModel
    /// </summary>
    [DataContract]
    public class ExaminationViewModel : INotifyPropertyChanged
    {
        #region Members
        [DataMember(Name = "exam_time")]
        private string examTime;
        [DataMember(Name = "pass_score")]
        private string passScore;
        [DataMember(Name = "title")]
        private string title;
        [DataMember(Name = "content")]
        private ObservableCollection<KoolearnExamContent> content;
        #endregion

        #region Properties
        public string ExamTime
        {
            get { return examTime; }
            set { examTime = value; RaisePropertyChanged("ExamTime"); }
        }
        public string PassScore
        {
            get { return passScore; }
            set { passScore = value; RaisePropertyChanged("PassScore"); }
        }
        public string Title
        {
            get { return title; }
            set { title = value; RaisePropertyChanged("Title"); }
        }
        public ObservableCollection<KoolearnExamContent> Content
        {
            get { return content; }
            set { content = value; RaisePropertyChanged("Content"); }
        }
        #endregion

        #region INotifyPropertyChanged Members
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region Methods
        public void RaisePropertyChanged(string name)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }
        #endregion
    }
}
